﻿using System;
using System.Collections.Generic;
using System.Text;
using HardwareLibrary.ComLibrary;
using HardwareLibrary.IDReaderLibrary;
using HardwareLibrary.PLCLibrary;
using HardwareLibrary.MeterReaderLibrary;
using HardwareLibrary.FTPLibrary;
using System.Collections;

namespace MyExcelAddIn2003.Core
{
    /// <summary>
    /// 通用方法
    /// </summary>
    public class Utility
    {
        public static string BillWorkSheet = "过磅单";
        public static string WeightBill = "过磅单";
        public static string ArrivedCard = "货到证";
        public static string OverloadBill = "治超单";
        public static bool DataIsRuningBackgroud = false;

        public static ComHelper mCom;
        public static MeterReaderHelper weightCom;
        public static IDReaderHelper IDCom;
        public static PLCHelper PLCCom;
        public static string LocalPicSaveFolder;
        public static string ShouFaLeibie;
        public static WM_Struct wtInfo = new WM_Struct();
        public static FTP_Struct ftpInfo = new FTP_Struct();
        public static IDRead_Struct idRead = new IDRead_Struct();
        public static PLC_Struct plcStruct = new PLC_Struct();
        /// <summary>
        /// 采皮时是否使用注册皮重，使用注册皮重后就不使用真实皮重了
        /// </summary>
        public static bool IsEnableRegisterPi = false;
        #region 计量模块启动参数
        /// <summary>
        /// 是否允许调整扣损
        /// </summary>
        public static bool IsEnable_AdjustRate = false;
        /// <summary>
        /// 调整类型
        /// </summary>
        public static int AdjustRateType;
        /// <summary>
        /// 1，表示按比例调节
        /// </summary>
        public static int Rate = 1;
        /// <summary>
        /// 2,表示按数值调节
        /// </summary>
        public static int Num = 2;
        /// <summary>
        /// 调节数值
        /// </summary>
        public static double RateOrNumValue = 0;
        #endregion
        /// <summary>
        /// 数值数值，真实数值
        /// </summary>
        public static double RealMeterValue = 0;
        /// <summary>
        /// 输出数值,带扣重情况
        /// </summary>
        public static double OutPutValue = 0;
        /// <summary>
        /// 当前计量次数，即1表示一次计量，2表示2次计量
        /// </summary>
        public static int CurrentWeightNum = 1;
        /// <summary>
        /// 仪表数值归零状态
        /// </summary>
        public static bool isZore;
        /// <summary>
        /// 仪表数值稳定状态
        /// </summary>
        public static bool isStable;
        /// <summary>
        /// 是否启用仪表
        /// </summary>
        public static bool IsEnable_YB;
        /// <summary>
        /// 仪表运行状态
        /// </summary>
        public static bool isRunning_YB;
        /// <summary>
        /// 是否启用ID读卡器
        /// </summary>
        public static bool IsEnable_ID;
        /// <summary>
        /// ID读卡器运行状态
        /// </summary>
        public static bool isRunning_ID;
        /// <summary>
        /// 是否启用PCI
        /// </summary>
        public static bool IsEnable_PCI;
        /// <summary>
        /// PCI运行状态
        /// </summary>
        public static bool isRunning_PCI;
        /// <summary>
        /// 是否启用FTP
        /// </summary>
        public static bool IsEnable_FTP;
        /// <summary>
        /// DVR监控是否启用
        /// </summary>
        public static bool IsEnable_DVR;
        /// <summary>
        /// FTP运行状态
        /// </summary>
        public static bool isRunning_FTP;
        /// <summary>
        /// 是否启用大屏幕
        /// </summary>
        public static bool isEnable_OutScreen;
        /// <summary>
        /// 大屏幕输出状态
        /// </summary>
        public static bool isRunning_OutScreen;
        /// <summary>
        /// 是否启用IC读卡器
        /// </summary>
        public static bool IsEnable_IC;
        /// <summary>
        /// IC卡运行状态
        /// </summary>
        public static bool isRunning_IC;
        /// <summary>
        /// 是否启用PLC
        /// </summary>
        public static bool IsEnable_PLC;
        /// <summary>
        /// PLC运行状态
        /// </summary>
        public static bool isRunning_PLC;
        /// <summary>
        /// 仪表数值大小调整情况，此处只允许增加的情况
        /// </summary>
        public static string[] UpArr = new string[] { "发货", "收货退货" };
        /// <summary>
        /// 仪表数值大小调整情况，此处只允许递减的情况
        /// </summary>
        public static string[] DownArr = new string[] { "收货", "发货退货" };
        /// <summary>
        /// 仪毛重
        /// </summary>
        public static double YMweight;
        /// <summary>
        /// 仪皮重
        /// </summary>
        public static double YPweight;
        public static string Bill_Time;
        /// <summary>
        /// 是否锁定了DVR监控的数值，主要是由于磅单编码在数据保存之后才能产生，故只有在编码产生后才拍照保存。因此需要锁定数值防止在保存图片的时候发生变动
        /// </summary>
        public static bool LockedDVRNum = false;
        public static Hashtable htVO = new Hashtable();

        public static void CreateBillVO()
        {
            if (htVO.Count == 0)
            {
                htVO.Add("textBox_sflb", "收发类别");
                htVO.Add("textBox_chmc", "存货名称");
                htVO.Add("textBox_bdrq", "磅单日期");
                htVO.Add("textBox_bdbm", "磅单编码");
                htVO.Add("textBox_clxh", "车辆序号");
                htVO.Add("textBox_sfdh", "收发单号");
                htVO.Add("textBox_htdm", "合同代码");
                htVO.Add("textBox_ggxh", "规格");
                htVO.Add("textBox_ksmc", "客商名称");
                htVO.Add("textBox_cphm", "车牌号码");
                htVO.Add("textBox_ph", "票号");
                htVO.Add("textBox_cydw", "承运单位");
                htVO.Add("textBox_cd", "产地");
                htVO.Add("textBox_sjxm", "司机姓名");
                htVO.Add("textBox_clzs", "轴数");
                htVO.Add("textBox_jhlb", "计划类别");
                htVO.Add("textBox_xhdd", "收货地点");
                htVO.Add("textBox_fhdd", "发货地点");
                htVO.Add("textBox_pczh", "派车证号");
                htVO.Add("textBox_yffs", "运费方式");
                htVO.Add("textBox_jsfs", "结算方式");
                htVO.Add("textBox_xhck", "收货仓库");
                htVO.Add("textBox_fhck", "发货仓库");
                htVO.Add("textBox_bcmz", "本厂毛重");
                htVO.Add("textBox_bcpz", "本厂皮重");
                htVO.Add("textBox_bckz", "本厂扣重");
                htVO.Add("textBox_bcjz", "本厂净重");
                htVO.Add("textBox_cmsj", "过毛时间");
                htVO.Add("textBox_dfmz", "对方毛重");
                htVO.Add("textBox_dfpz", "对方皮重");
                htVO.Add("textBox_dfkz", "对方扣重");
                htVO.Add("textBox_dfjz", "对方净重");
                htVO.Add("textBox_cpsj", "过皮时间");
                htVO.Add("textBox_jly", "司磅员");
                htVO.Add("textBox_kpy", "开票员");
                htVO.Add("textBox_jby", "监磅员");
                htVO.Add("textBox_bc", "磅差");
                htVO.Add("textBox_bz", "备注");
            }
        }
    }
    
}
